#include<bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define debug  freopen("in.txt","r",stdin),freopen("out.txt","w",stdout);
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 1e5+10;
const int mod = 1000000007;
using namespace std;

int N;
ll f[maxn][2];
int h[maxn],e[maxn*2],ne[maxn*2],idx;
void add(int a,int b){
    e[++idx] = b,ne[idx] = h[a],h[a] = idx;
}

void dfs(int u,int fa = -1){
    bool isyz = true;
    for(int i = h[u]; i ;i = ne[i]){
        int v = e[i];
        if(v == fa) continue;
        isyz = false;
        dfs(v,u);
    }
    if(isyz) f[u][1] = 1,f[u][0] = 1;
    else{
        ll black =  1,white = 1;
        for(int i = h[u]; i; i = ne[i]){
            int v = e[i];
            if(v == fa) continue;
            black *= f[v][1]; black %= mod;
            white *= (f[v][1] + f[v][0])%mod; white %= mod;
        }
        f[u][0] = black,f[u][1] = white;
    }
}
int main(){
    // debug;
    ios;

    cin>>N;
    for(int i = 1;i<=N-1;i++){
        int x,y;cin>>x>>y;
        add(x,y);
        add(y,x);
    }
    dfs(1);
    cout<<(f[1][0] + f[1][1])%mod;

    
    return 0;
}
